#!/bin/sh

set -e

if [ "$1" = "configure" ] ; then
    if [ -e /etc/gdm/PostSession/Default ] ; then
        sed -e "2i\
# Start-AutoFsck: section autmatically added by AutoFsck\n\
# Launch AutoFsck V3.0 after session ends\n\
/usr/bin/autofsck --check\n\
# End-AutoFsck" -i /etc/gdm/PostSession/Default
    fi
    if [ -e /etc/kde3/kdm/Xreset ] ; then
        sed -e "2i\
# Start-AutoFsck: section autmatically added by AutoFsck\n\
# Launch AutoFsck V3.0 after session ends\n\
/usr/bin/autofsck --check\n\
# End-AutoFsck" -i /etc/kde3/kdm/Xreset
    fi
    ln -f -s /etc/init.d/autofsck /etc/rc0.d/S85autofsck
fi

exit 0
